# Maintainer: Florian Pritz <bluewind@xinu.at>

pkgname=perl-lchown
pkgver=1.01
pkgrel=15
pkgdesc="use the lchown(2) system call from Perl"
arch=(loong64 x86_64)
license=(PerlArtistic GPL)
options=(!emptydirs)
depends=('perl')
makedepends=('perl-module-build')
url=https://metacpan.org/release/Lchown
source=("https://search.cpan.org/CPAN/authors/id/N/NC/NCLEATON/Lchown-${pkgver}.tar.gz")
sha256sums=('9c0a13e279ad92208fb8fac73001635b0689251dd41b597522e1b3501ba0f76f')

build() {
    export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
      PERL_AUTOINSTALL=--skipdeps                            \
      PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='"$pkgdir"'"     \
      PERL_MB_OPT="--installdirs vendor --destdir '"$pkgdir"'" \
      MODULEBUILDRC=/dev/null

    cd "${srcdir}/Lchown-${pkgver}"
    /usr/bin/perl Build.PL
    ./Build
}

check() {
    export PERL_MM_USE_DEFAULT=1 PERL5LIB=""
    cd "${srcdir}/Lchown-${pkgver}"
    ./Build test
}

package() {
    cd "${srcdir}/Lchown-${pkgver}"
    ./Build install
    find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}
